export class MDNCommandLinkHelper {
    public static WebGL2RootUrl = "https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/";
    public static WebGLRootUrl = "https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/";

    public static WebGL2Functions: { [key: string]: string } = {
        beginQuery: "beginQuery",
        beginTransformFeedback: "beginTransformFeedback",
        bindBufferBase: "bindBufferBase",
        bindBufferRange: "bindBufferRange",
        bindSampler: "bindSampler",
        bindTransformFeedback: "bindTransformFeedback",
        bindVertexArray: "bindVertexArray",
        blitFramebuffer: "blitFramebuffer",
        clearBufferfv: "clearBuffer",
        clearBufferiv: "clearBuffer",
        clearBufferuiv: "clearBuffer",
        clearBufferfi: "clearBuffer",
        clientWaitSync: "clientWaitSync",
        compressedTexImage3D: "compressedTexImage3D",
        compressedTexSubImage3D: "compressedTexSubImage3D",
        copyBufferSubData: "copyBufferSubData",
        copyTexSubImage3D: "copyTexSubImage3D",
        createQuery: "createQuery",
        createSampler: "createSampler",
        createTransformFeedback: "createTransformFeedback",
        createVertexArray: "createVertexArray",
        deleteQuery: "deleteQuery",
        deleteSampler: "deleteSampler",
        deleteSync: "deleteSync",
        deleteTransformFeedback: "deleteTransformFeedback",
        deleteVertexArray: "deleteVertexArray",
        drawArraysInstanced: "drawArraysInstanced",
        drawBuffers: "drawBuffers",
        drawElementsInstanced: "drawElementsInstanced",
        drawRangeElements: "drawRangeElements",
        endQuery: "endQuery",
        endTransformFeedback: "endTransformFeedback",
        fenceSync: "fenceSync",
        framebufferTextureLayer: "framebufferTextureLayer",
        getActiveUniformBlockName: "getActiveUniformBlockName",
        getActiveUniformBlockParameter: "getActiveUniformBlockParameter",
        getActiveUniforms: "getActiveUniforms",
        getBufferSubData: "getBufferSubData",
        getFragDataLocation: "getFragDataLocation",
        getIndexedParameter: "getIndexedParameter",
        getInternalformatParameter: "getInternalformatParameter",
        getQuery: "getQuery",
        getQueryParameter: "getQueryParameter",
        getSamplerParameter: "getSamplerParameter",
        getSyncParameter: "getSyncParameter",
        getTransformFeedbackVarying: "getTransformFeedbackVarying",
        getUniformBlockIndex: "getUniformBlockIndex",
        getUniformIndices: "getUniformIndices",
        invalidateFramebuffer: "invalidateFramebuffer",
        invalidateSubFramebuffer: "invalidateSubFramebuffer",
        isQuery: "isQuery",
        isSampler: "isSampler",
        isSync: "isSync",
        isTransformFeedback: "isTransformFeedback",
        isVertexArray: "isVertexArray",
        pauseTransformFeedback: "pauseTransformFeedback",
        readBuffer: "readBuffer",
        renderbufferStorageMultisample: "renderbufferStorageMultisample",
        resumeTransformFeedback: "resumeTransformFeedback",
        samplerParameteri: "samplerParameter",
        samplerParameterf: "samplerParameter",
        texImage3D: "texImage3D",
        texStorage2D: "texStorage2D",
        texStorage3D: "texStorage3D",
        texSubImage3D: "texSubImage3D",
        transformFeedbackVaryings: "transformFeedbackVaryings",
        uniform1ui: "uniform",
        uniform2ui: "uniform",
        uniform3ui: "uniform",
        uniform4ui: "uniform",
        uniform1fv: "uniform",
        uniform2fv: "uniform",
        uniform3fv: "uniform",
        uniform4fv: "uniform",
        uniform1iv: "uniform",
        uniform2iv: "uniform",
        uniform3iv: "uniform",
        uniform4iv: "uniform",
        uniform1uiv: "uniform",
        uniform2uiv: "uniform",
        uniform3uiv: "uniform",
        uniform4uiv: "uniform",
        uniformBlockBinding: "uniformBlockBinding",
        uniformMatrix2fv: "uniformMatrix",
        uniformMatrix3x2fv: "uniformMatrix",
        uniformMatrix4x2fv: "uniformMatrix",
        uniformMatrix2x3fv: "uniformMatrix",
        uniformMatrix3fv: "uniformMatrix",
        uniformMatrix4x3fv: "uniformMatrix",
        uniformMatrix2x4fv: "uniformMatrix",
        uniformMatrix3x4fv: "uniformMatrix",
        uniformMatrix4fv: "uniformMatrix",
        vertexAttribDivisor: "vertexAttribDivisor",
        vertexAttribI4i: "vertexAttribI",
        vertexAttribI4ui: "vertexAttribI",
        vertexAttribI4iv: "vertexAttribI",
        vertexAttribI4uiv: "vertexAttribI",
        vertexAttribIPointer: "vertexAttribIPointer",
        waitSync: "waitSync",
    };

    public static WebGLFunctions: { [key: string]: string } = {
        uniform1f: "uniform",
        uniform1fv: "uniform",
        uniform1i: "uniform",
        uniform1iv: "uniform",
        uniform2f: "uniform",
        uniform2fv: "uniform",
        uniform2i: "uniform",
        uniform2iv: "uniform",
        uniform3f: "uniform",
        uniform3i: "uniform",
        uniform3iv: "uniform",
        uniform4f: "uniform",
        uniform4fv: "uniform",
        uniform4i: "uniform",
        uniform4iv: "uniform",
        uniformMatrix2fv: "uniformMatrix",
        uniformMatrix3fv: "uniformMatrix",
        uniformMatrix4fv: "uniformMatrix",
        vertexAttrib1f: "vertexAttrib",
        vertexAttrib2f: "vertexAttrib",
        vertexAttrib3f: "vertexAttrib",
        vertexAttrib4f: "vertexAttrib",
        vertexAttrib1fv: "vertexAttrib",
        vertexAttrib2fv: "vertexAttrib",
        vertexAttrib3fv: "vertexAttrib",
        vertexAttrib4fv: "vertexAttrib",
    };

    public static getMDNLink(commandName: string): string {
        const webgl2Name = MDNCommandLinkHelper.WebGL2Functions[commandName];
        if (webgl2Name) {
            return MDNCommandLinkHelper.WebGL2RootUrl + webgl2Name;
        }
        const webglName = MDNCommandLinkHelper.WebGLFunctions[commandName];
        if (webglName) {
            return MDNCommandLinkHelper.WebGLRootUrl + webglName;
        }
        return MDNCommandLinkHelper.WebGLRootUrl + commandName;
    }
}
